/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author bluepc
 */
@Entity
@Table(name = "BookTable")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BookTable.findAll", query = "SELECT b FROM BookTable b"),
    @NamedQuery(name = "BookTable.findByIdBook", query = "SELECT b FROM BookTable b WHERE b.idBook = :idBook"),
    @NamedQuery(name = "BookTable.findByBookdate", query = "SELECT b FROM BookTable b WHERE b.bookdate = :bookdate")})
public class BookTable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer idBook;
    @Column(name = "bookdate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date bookdate;
    @JoinColumn(name = "id_time", referencedColumnName = "id_time")
    @ManyToOne
    private TimeMeal idTime;
    @JoinColumn(name = "id_table", referencedColumnName = "id_table")
    @ManyToOne
    private Tables idTable;
    @JoinColumn(name = "id_cus", referencedColumnName = "id_cus")
    @ManyToOne
    private Customers idCus;

    public BookTable() {
    }

    public BookTable(Integer idBook) {
        this.idBook = idBook;
    }

    public Integer getIdBook() {
        return idBook;
    }

    public void setIdBook(Integer idBook) {
        this.idBook = idBook;
    }

    public Date getBookdate() {
        return bookdate;
    }

    public void setBookdate(Date bookdate) {
        this.bookdate = bookdate;
    }

    public TimeMeal getIdTime() {
        return idTime;
    }

    public void setIdTime(TimeMeal idTime) {
        this.idTime = idTime;
    }

    public Tables getIdTable() {
        return idTable;
    }

    public void setIdTable(Tables idTable) {
        this.idTable = idTable;
    }

    public Customers getIdCus() {
        return idCus;
    }

    public void setIdCus(Customers idCus) {
        this.idCus = idCus;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBook != null ? idBook.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BookTable)) {
            return false;
        }
        BookTable other = (BookTable) object;
        if ((this.idBook == null && other.idBook != null) || (this.idBook != null && !this.idBook.equals(other.idBook))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.BookTable[ idBook=" + idBook + " ]";
    }
    
}
